<script setup>
import { routes } from '@/router'
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper'
import keepAliveStore from "@/store/modules/keepalive";
const keepStore = keepAliveStore()

const tipRef = ref()
const tip = ref({
  visible: false,
  content: '',
  ref: null
})
const updateTip = (val) => {
  tip.value = val
}

provide('updateTip', updateTip)
const _setForm =  sessionStorage.getItem('_setForm')
if(!_setForm) sessionStorage.setItem('_setForm', '{}')
</script>

<template>
  <!-- 在 qiankun 环境中不显示菜单 -->
  <!-- <div v-if="!qiankunWindow.__POWERED_BY_QIANKUN__" class="flex my-2 justify-center gap-2">
    <div v-for="(item, index) in routes" :key="index" class="hover:text-blue-500">
      <router-link :to="item.path">{{ item.meta.title || item.name }}</router-link>
    </div>
  </div> -->

  <!-- {{ keepStore.keepAliveList }} -->
  <router-view v-slot="{ Component }">
    <keep-alive :include="keepStore.keepAliveList">
      <component :is="Component" />
    </keep-alive>
  </router-view>

  <el-tooltip ref="tipRef" :visible="tip.visible" :content="tip.content" :virtual-ref="tip.ref" virtual-triggering placement="top" popper-class="app-tip" :offset="3" enterable />
</template>
